package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysClientDataMin;
import com.ruoyi.system.service.ISysClientDataMinService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 产线运行记录每分钟Controller
 * 
 * @author spark
 * @date 2023-08-20
 */
@RestController
@RequestMapping("/system/min")
public class SysClientDataMinController extends BaseController
{
    @Autowired
    private ISysClientDataMinService sysClientDataMinService;

    /**
     * 查询产线运行记录每分钟列表
     */
    @PreAuthorize("@ss.hasPermi('system:min:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysClientDataMin sysClientDataMin)
    {
        startPage();
        List<SysClientDataMin> list = sysClientDataMinService.selectSysClientDataMinList(sysClientDataMin);
        return getDataTable(list);
    }

    /**
     * 导出产线运行记录每分钟列表
     */
    @PreAuthorize("@ss.hasPermi('system:min:export')")
    @Log(title = "产线运行记录每分钟", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysClientDataMin sysClientDataMin)
    {
        List<SysClientDataMin> list = sysClientDataMinService.selectSysClientDataMinList(sysClientDataMin);
        ExcelUtil<SysClientDataMin> util = new ExcelUtil<SysClientDataMin>(SysClientDataMin.class);
        util.exportExcel(response, list, "产线运行记录每分钟数据");
    }

    /**
     * 获取产线运行记录每分钟详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:min:query')")
    @GetMapping(value = "/{dataId}")
    public AjaxResult getInfo(@PathVariable("dataId") Long dataId)
    {
        return success(sysClientDataMinService.selectSysClientDataMinByDataId(dataId));
    }

    /**
     * 新增产线运行记录每分钟
     */
    @PreAuthorize("@ss.hasPermi('system:min:add')")
    @Log(title = "产线运行记录每分钟", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysClientDataMin sysClientDataMin)
    {
        return toAjax(sysClientDataMinService.insertSysClientDataMin(sysClientDataMin));
    }

    /**
     * 修改产线运行记录每分钟
     */
    @PreAuthorize("@ss.hasPermi('system:min:edit')")
    @Log(title = "产线运行记录每分钟", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysClientDataMin sysClientDataMin)
    {
        return toAjax(sysClientDataMinService.updateSysClientDataMin(sysClientDataMin));
    }

    /**
     * 删除产线运行记录每分钟
     */
    @PreAuthorize("@ss.hasPermi('system:min:remove')")
    @Log(title = "产线运行记录每分钟", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dataIds}")
    public AjaxResult remove(@PathVariable Long[] dataIds)
    {
        return toAjax(sysClientDataMinService.deleteSysClientDataMinByDataIds(dataIds));
    }
}
